<template>
	<div>
		<header-footer :commonData="{$parent:$parent}">
			<div class="online_apply" v-cloak>
				<div class="crumb">
					<ul>
						<li class="color666 f_left">当前位置：</li>
						<li>
							<router-link class="color666 f_left" to="/home">首页></router-link>
						</li>
						<li class="color666 f_left">企业报名</li>
					</ul>
				</div>
				<div v-if="!isSubmit" class="border_content text_center company_apply_info">
					<img src="/static/img/title1.png" class="contTitleImg">
					<h3 class="apply_title">专业技术人员继续教育报名</h3>
					<h4 class="apply_title_explain">请填写您的报名信息</h4>
					<el-form class="apply_form" ref="form" :rule="form" label-width="120px">
						<el-form-item label="考生报名信息：" class="choose_project">
							<el-upload class="avatar-uploader" accept=".zip" action="https://jsonplaceholder.typicode.com/posts/" :show-file-list="false"
							 :on-success="imageIdCardSuccess">
								<el-input v-model="form.url" readonly></el-input>
							</el-upload>
							<!-- <el-input v-model="form.url" readonly @focus="ticketDialogs = true"></el-input> -->
							<a type="button" class="select_class">
								<el-upload class="avatar-uploader" action="https://jsonplaceholder.typicode.com/posts/" :show-file-list="false"
								 :on-success="imageIdCardSuccess">
									浏览
								</el-upload>
							</a>
						</el-form-item>
						<el-form-item label="选择发票信息：" class="choose_project">
							<el-input v-model="invoiceTitle" readonly @focus="ticketDialogs = true"></el-input>
							<a type="button" class="select_class" @click="ticketDialogs = true">选择发票</a>
						</el-form-item>
						<el-form-item class="apply_btns">
							<router-link class="apply_return" to="/cont_education/index">返回</router-link>
							<a @click="onSubmit">上传</a>
						</el-form-item>
					</el-form>
					<!-- 选择发票 -->
					<el-dialog :visible.sync="ticketDialogs">
						<ticketDialog @ticketDialogBtn="ticketDialogBtns" :showBtn="1"></ticketDialog>
					</el-dialog>
				</div>
			</div>
			<div v-if="isSubmit">
				<companyConfirmApplyinfo :submitResult="submitResult" :type="type" v-on:goPrev="goPrev">
				</companyConfirmApplyinfo>
			</div>
			<!-- 报名后未付款弹框 -->
			<!-- <apply-nopay :nopayData="{currentApply:currentApply,type:1}"></apply-nopay> -->
		</header-footer>
	</div>
</template>

<script>
	import headerFooter from '../../../components/cont_education/header_and_footer.vue'
	// import applyNopay from '../../../components/home/apply_nopay.vue'
	import ticketDialog from '../../../components/invoice_lists.vue'
	import companyConfirmApplyinfo from '../../../components/home/company_confirm_applyinfo.vue'
	export default {
		name: "company_apply",
		data: function() {
			return {
				isSubmit: false,
				ticketDialogs: false,
				form: {},
				currentApply:undefined,
				type: this.$route.params.type,
				invoiceType:0,
				invoiceTitle:"",
				invoiceTempId:0
			}
		},
		mounted: function() {

		},
		methods: {
			imageIdCardSuccess: function(res, file) {
				// this.imageIdCard = URL.createObjectURL(file.raw);
			},
			handleAvatarSuccess: function(res, file) {
				// this.imageUrl = URL.createObjectURL(file.raw);
			},
			ticketDialogBtns: function(data) {
				console.log(data)
				if (data == false) {
					this.ticketDialogs = false;
					return;
				}
				this.ticketDialogs = false;
				this.invoiceTitle=data.invoiceTitle;
				this.invoiceTempId = data.invoiceTempId;
				this.invoiceType = data.invoiceType;
			},
			goPrev: function() {
				this.isSubmit = false;
				this.submitResult = undefined;
			},
			onSubmit: function() {
				this.isSubmit = true;
// 				this.common.post(this.api.merchantApply, {
// 				    maps: JSON.stringify(that.sApplyArrs),
// 				    invoiceType: this.type
// 				}, function(res) {
// 				    that.isSubmit = true;
// 				    that.submitResult = res.resultMap;
// 				});
				this.submitResult = {
					companyName: "浙江小锤",
					price: 200,
					loseApply: [{
						realName: "张三",
						identity: "3422221513564563",
						telephone: "18297608023",
						typeName: "建筑焊工",
						remark: "企业名称不一致"
					}],
					succeeApply: [{
							realName: "张三",
							identity: "3422221513564563",
							telephone: "18297608023",
							typeName: "建筑焊工建筑焊工",
							price: 100,
							remark: "企业名称不一致",
							education: "大专",
							lilun: "报名+培训",
							shicao: "报名+培训"
						},
						{
							realName: "张三",
							identity: "3422221513564563",
							telephone: "18297608023",
							typeName: "建筑焊工",
							price: 100,
							remark: "企业名称不一致"
						},
						{
							realName: "张三",
							identity: "3422221513564563",
							telephone: "18297608023",
							typeName: "建筑焊工",
							price: 100,
							remark: "企业名称不一致"
						},
					]
				};
			}
		},
		components: {
			headerFooter,
			// applyNopay,
			ticketDialog,
			companyConfirmApplyinfo
		}
	}
</script>

<style>
	.el-checkbox {
		margin-right: 0;
	}

	.company_apply_info .el-upload.el-upload--text {
		width: 100%;
	}
</style>
